package com.wsx.ones.boots.grpc;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.net.InetAddress;
import java.util.List;

/**
 * @author wangshuaixin
 * @Title: com.wsx.ones.boots.grpc.GrpcConfig
 * @Description: grpc的核心配置内容
 * @date 2019/05/21
 */
@NoArgsConstructor
public class GrpcConfig {

    //注册中心信息
    @Setter @Getter private GrpcSchema registerSchema = GrpcSchema.CONSUL;
    @Setter @Getter private String registerUrl;

    //当前服务器信息
    @Setter @Getter private String host = localhost();
    @Setter @Getter private int port = 10811;

    //当前提供的负载信息
    @Setter @Getter private String lbp = "round_robin";


    public static String localhost() {
        try {
            return InetAddress.getLocalHost().getHostAddress();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "127.0.0.1";
    }
}
